package your_car_status

class RepairShop {
    
    int id
    String name
    String username
    String address
    String phone
    String password
    String confirmPassword
    static hasMany = [ mechanicalTechnician: MechanicalTechnician , customer:Customer , servicePackages:ServicePackage]
    static constraints = {
        id blank : false , unique : true
        name blank : false , matches: "[a-zA-Z- ]+"
        username unique : true
        address blank : false
        phone blank : false , size : 7..12 , matches: "[(0-9)]+"
        password(blank: false, size: 5..15 , password:true, validator: {password, obj ->
         def confirmPassword = obj.properties['confirmPassword']
         if(confirmPassword == null) return true // skip matching password validation (only important when setting/resetting pass)
         confirmPassword == password ? true : ['invalid.matchingpasswords']
     })
        confirmPassword blank: false, size: 5..15 , password:true
    }
    
}

